<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags"%>
<%@ taglib prefix="presentation" uri="http://trela.com/paymeontime/tags/payments-presentation"%>
<ul class="list-group">
    <c:forEach var="paymentItem" varStatus="loop" items="${paymentsContext.paymentItems}">
        <c:if test="${loop.index eq paymentsContext.balanceInfo.balanceDateMarkerIndex}">
            <li class="date-indicator" >
                <div>
                    <span class="glyphicon glyphicon-chevron-right"></span>
                    <joda:format value="${paymentsContext.balanceInfo.balanceDateTime}" style="L-" />
                    <hr>
                </div>
            </li>
        </c:if>
        <li class="list-group-item color-${presentation:checkParity(paymentItem.dueDate)}">
            <c:if test="${paymentItem.payment.type == 'INCOME' }">
                <span class="glyphicon glyphicon-plus-sign color-green"></span>
            </c:if>
            <c:if test="${paymentItem.payment.type == 'OUTCOME' }">
                <span class="glyphicon glyphicon-minus-sign color-red"></span>
            </c:if>
            <joda:format value="${paymentItem.dueDate}" style="S-" /> 
            <span>${paymentItem.payment.label}</span>
            <strong><fmt:formatNumber currencyCode="PLN" value="${paymentItem.payment.value}" type="currency"/></strong>
            
            <div class="pull-right">
                <c:if test="${paymentItem.payment.occurence == 'MONTHLY' }">
                    <span class="label label-primary">Stałe</span>
                </c:if>
                <c:if test="${paymentItem.payment.priority == 'OPTIONAL' }">
                    <span class="label label-success">Opcja</span>
                </c:if>
                <c:if test="${paymentItem.payment.priority == 'IMPORTANT' }">
                    <span class="label label-danger">Ważne</span>
                </c:if>
            </div>
        </li>
    </c:forEach>
</ul>